package com.nbcio.pm.domain.bo;

import com.nbcio.common.core.validate.AddGroup;
import com.nbcio.common.core.validate.EditGroup;
import com.nbcio.common.mybatis.core.domain.BaseEntity;
import com.nbcio.pm.domain.PmProjectDocument;
import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * 项目文档业务对象 pm_project_document
 *
 * @author nbacheng
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "项目文档业务对象")
@AutoMapper(target = PmProjectDocument.class, reverseConvertGenerate = false)
public class PmProjectDocumentBo extends BaseEntity {

    /**
     * 文档ID
     */
    @Schema(description = "文档ID")
    private Long docId;

    /**
     * 项目ID
     */
    @Schema(description = "项目ID", required = true)
    @NotNull(message = "项目ID不能为空", groups = { AddGroup.class, EditGroup.class })
    private Long projectId;

    /**
     * 任务ID
     */
    @Schema(description = "任务ID")
    private Long taskId;

    /**
     * 文档名称
     */
    @Schema(description = "文档名称", required = true)
    @NotBlank(message = "文档名称不能为空", groups = { AddGroup.class, EditGroup.class })
    private String docName;

    /**
     * 文档类型：file-文件，folder-文件夹
     */
    @Schema(description = "文档类型：file-文件，folder-文件夹")
    private String docType;

    /**
     * 文件路径
     */
    @Schema(description = "文件路径")
    private String filePath;

    /**
     * 文件大小
     */
    @Schema(description = "文件大小")
    private Long fileSize;

    /**
     * 文件扩展名
     */
    @Schema(description = "文件扩展名")
    private String fileExtension;

    /**
     * 版本号
     */
    @Schema(description = "版本号")
    private String version;

    /**
     * 父文档ID
     */
    @Schema(description = "父文档ID")
    private Long parentId;

    /**
     * 排序
     */
    @Schema(description = "排序")
    private Integer sortOrder;

    /**
     * 是否公开
     */
    @Schema(description = "是否公开")
    private Boolean isPublic;

    /**
     * 下载次数
     */
    @Schema(description = "下载次数")
    private Integer downloadCount;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    // 关联字段（非数据库字段）
    @Schema(description = "项目名称")
    private String projectName;

    @Schema(description = "任务名称")
    private String taskName;

    @Schema(description = "上传者名称")
    private String uploaderName;

    @Schema(description = "文件大小格式化")
    private String fileSizeFormatted;

    @Schema(description = "上传时间格式化")
    private String uploadTimeFormatted;
}
